#ifndef JOBEXECUTOR_H
#define JOBEXECUTOR_H

namespace bimar_scheduler_lib
{

class CJobExecutor : public CGThreadWrapper
{
public:
  CJobExecutor();
  virtual ~CJobExecutor();

  gboolean StartJob(CJob *job);
  gboolean WaitJobDone(gulong milis = WAIT_INFINITE);
  gboolean AbortCurrentJob();
  gboolean StopCurrentJob();
  gboolean ResumeCurrentJob();
  gboolean PauseCurrentJob();
  gboolean IsIdle();

protected:
  /* CGThreadWrapper overrides */
  gulong RunThread();

  gboolean CreateScheduler(CJob *job);
  gboolean DestroyScheduler();

protected:
  CJobScheduler *m_currentScheduler;			//!< no task owner
  CJob *m_currentJob;
  CGCriticalSectionWrapper m_currentJobCS;
};

}; /* namespace */

#endif
